<template>
  <div>
    <div ref="echarts" style="width: 100%;height: 250px;" />
  </div>
</template>

<script>
import * as echarts from 'echarts'
export default {
  components: {},
  data() {
    return {
    }
  },
  mounted() {
    this.initEchart()
  },
  methods: {
    initEchart() {
      const myCharts = echarts.init(this.$refs.echarts)
      // console.log(myCharts)
      const option = {
        tooltip: {
          trigger: 'item',
          formatter: ' {b} :  {d}%'
        },
        legend: {
          show: false,
          top: '5%',
          left: 'center'
        },
        color: ['#e2dbda', '#f3ab2d'],
        series: [
          {
            name: 'Access From',
            type: 'pie',
            radius: ['50%', '70%'],
            center: ['50%', '60%'],
            avoidLabelOverlap: false,
            label: {
              show: false,
              position: 'center'
            },
            emphasis: {
              label: {
                show: true,
                fontSize: '20',
                fontWeight: 'bold',
                color: '#efac3c'
              }
            },
            labelLine: {
              show: true
            },
            data: [
              { value: 100, name: '冻结库存' },
              { value: 887, name: '可用库存' }

            ]
          }
        ]
      }
      myCharts.setOption(option)
      window.addEventListener('resize', myCharts.resize)
    }
  }
}
</script>

<style>
.div{
    color:#f3ab2d ;
}
</style>
